<template>
  <!-- 灾情勘察 反馈 -->
  <div class="EmergencyList">
    <div class="flex location-wrap">
      <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EDManagement' }">应急处置</el-breadcrumb-item>
        <el-breadcrumb-item>灾情勘察</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="box">
      <!-- 列表筛选 -->
      <filterTitle @query="query(form)" @reset="reset" :form="form" :formData="formData" labelWidth="140px"
        @node-click="handleSelectTreeTabulation">
        <!-- <el-form slot="filter" class="form" ref="form" :model="form" inline size="small" label-width="140px">
          <el-form-item :label="item.label + '：'" v-for="(item, index) in formData" :key="index" :prop="item.id">
            <LsdForm :compData="item" :form="form" @node-click="handleSelectTreeTabulation(arguments, item)" />
          </el-form-item>
        </el-form> -->
      </filterTitle>
      <!-- 列表表格 -->
      <LsdTable slot="gjxm" @select="handleSelectionChange" @select-all="handleSelectionChange"
        :paginationAtrrs="paginationAtrrs" @pageChange="handleSizeChange" :compRef="table.compRef" ref="gjxm"
        :columns="table.columns" :title="table.title" :actions="table.actions" :tableData="table.tableData"
        :tableAttr="table.tableAttr" :isShowPage="table.isShowPage" :isSelectFlag="table.isSelectFlag"
        :isSequenceFlag="table.isSequenceFlag" @onActionClick="onActionClick" />
    </div>
    <!-- 弹窗信息 -->
    <LsdDialog :dialogConfig="dialogConfig" @handleBtn="handleBtn" @close="close">
      <LsdDialogTitle slot="dialog" :titleConfig="titleConfig" :activeNames="activeNames">
        <DialogForm ref="formComponent" slot="slot1" :formConfig="formConfig" @changeEvent="handleChange" />
        <DialogForm ref="formComponent1" slot="slot2" @handleupdata="handleupdata" @changeEvent="handleChange1"
          :formConfig="formConfig1" />
        <DialogForm ref="formComponent2" slot="slot3" :formConfig="formConfig2" @handleBtnInput="handleBtnInput"
          @getResourcesData="getResourcesData" />
        <!-- 队伍选择后回显到选队伍弹窗-->
        <!-- <LsdTable ref="WeatherForecasts1" v-if="ranksList !==undefined && ranksList != null  && ranksList.length > 0 " slot="slot3" @select="handleSelectionChange1" @select-all="handleSelectionChange1" :paginationAtrrs="WeatherForecasts1.paginationAtrrs" @pageChange="handleSize" :compRef="WeatherForecasts1.compRef" :columns="WeatherForecasts1.columns" :title="WeatherForecasts1.title" :actions="WeatherForecasts1.actions" :tableData="WeatherForecasts1.tableData" :tableAttr="WeatherForecasts1.tableAttr" :isShowPage="WeatherForecasts1.isShowPage" :isSelectFlag="WeatherForecasts1.isSelectFlag" :isSequenceFlag="WeatherForecasts1.isSequenceFlag" @onActionClick="onActionClick" /> -->
        <DialogForm ref="formComponent3" slot="slot4" :formConfig="formConfig3" />
        <!-- <DialogForm ref="formComponent4" slot="slot5" :formConfig="formConfig4" /> -->
      </LsdDialogTitle>
    </LsdDialog>
    <!-- 弹窗信息选择队伍 -->
    <LsdDialog :dialogConfig="dialogConfig1" @handleBtn="handleBtn1" @close="close1">
      <div class="box" slot="dialog" style="position: relative;">
        <filterTitle @query="ranksQuery(form1)" @reset="ranksResetForm">
          <el-form slot="filter" class="form" ref="form1" :model="form1" inline size="small" label-width="130px">
            <el-form-item :label="item.label + '：'" v-for="(item, index) in formDatas" :key="index" :prop="item.id">
              <LsdForm :compData="item" :form="form1" @node-click="handleSelectTree(arguments, item)" />
            </el-form-item>
          </el-form>
        </filterTitle>
        <!-- 队伍选择 弹窗界面 -->
        <LsdTable slot="dialog" @select="handleSelectionChange3" :multiple="WeatherForecasts.multiple"
          @select-all="handleSelectionChange3" @pageChange="handleSizeChange1"
          :paginationAtrrs="WeatherForecasts.paginationAtrrs" :compRef="WeatherForecasts.compRef" ref="gjxm"
          :columns="WeatherForecasts.columns" :title="WeatherForecasts.title" :actions="WeatherForecasts.actions"
          :tableData="WeatherForecasts.tableData" :tableAttr="WeatherForecasts.tableAttr"
          :isShowPage="WeatherForecasts.isShowPage" :isSelectFlag="WeatherForecasts.isSelectFlag"
          :isSequenceFlag="WeatherForecasts.isSequenceFlag" @onActionClick="onActionClick" />
        <div class="teamSelectionClass">已选择{{ teamSelection }}名人员</div>
      </div>
    </LsdDialog>
    <LsdDialog :dialogConfig="dialogConfig2" @handleBtn="handleBtn2" @close="close2">
      <div class="box" slot="dialog">
        <filterTitle @query="onSubmitQuery(form)" @reset="resetFormQuery">
          <el-form slot="filter" class="form" ref="form" :model="form" inline size="small" label-width="130px">
            <el-form-item :label="item.label + '：'" v-for="(item, index) in formData1" :key="index" :prop="item.id">
              <LsdForm :compData="item" :form="form" />
            </el-form-item>
          </el-form>
        </filterTitle>
        <!-- 点击待命人数-待命人数弹窗 -->
        <div class="choiceNumClass">已选择{{ choiceNum }}名人员</div>
        <LsdTable slot="dialog" @select="handleSelectionChange2" @select-all="handleSelectionChange2"
          @pageChange="handleSizeChange2" :paginationAtrrs="TeamSelection.paginationAtrrs"
          :compRef="TeamSelection.compRef" ref="gjxm" :columns="TeamSelection.columns" :title="TeamSelection.title"
          :actions="TeamSelection.actions" :tableData="TeamSelection.tableData" :tableAttr="TeamSelection.tableAttr"
          :isShowPage="TeamSelection.isShowPage" :isSelectFlag="TeamSelection.isSelectFlag"
          :isSequenceFlag="TeamSelection.isSequenceFlag" @onActionClick="onActionClick" />
      </div>
    </LsdDialog>
  </div>
</template>

<script>
// fankuiListPage
import { zqkcFeedbackList, zqkcFeedbackUpdate, chooseTeamAdd, zqkcFeedbackDetail, ranksDataList, duiyuanDataList, listTeamType, getSelectedMember } from "@/api/EmergencyDisposal/zqkc.js";
// 响应命令单 列表接口
import { xymldSubmissionList } from "@/api/EmergencyDisposal/xymld.js";
// 公共接口   // BaseMockDepartment
import { getDictByGroup, BaseMockPerson, GetOrgTree, getOrggetSameLevel } from "@/api/common.js";
export default {
  name: "InformationList",
  components: {},
  data() {
    return {
      type: 0, // 区分编辑和新增
      multipleSelection: [], // 单选全选
      xymldSelectData: [], // 响应命令单下拉数据
      valueNameId: {}, // 新增时 选中的响应命令单名称和id
      editId: "",
      deleteId: "",
      dialogDelete: false,
      ranksList: [], // 选中队伍的数据
      StandbyId: "", // 点击队伍人数得id
      // 筛选信息
      formData: [
        {
          elType: "select",
          id: "sourceInfoId",
          label: "响应命令单",
          // dic: "dic_xqlb",
          attrs: {
            value: "",
            size: "small",
            // clearable: true,
            filterable: true,
            "collapse-tags": true,
            clearable: true
          },
          options: []
        },
        {
          elType: "input",
          id: "surveyName",
          label: "任务单名称",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true,
            clearable: true
          }
        },
        {
          elType: "input",
          id: "taskContent",
          label: "任务内容",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true,
            clearable: true
          }
        },
        {
          elType: "input",
          id: "taskAddress",
          label: "任务地点",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true,
            clearable: true
          }
        },
        {
          elType: "selectTree",
          id: "distributedUnitId",
          name: "distributedUnit",
          label: "派发单位/部门",
          attrs: {
            value: "",
            clearable: true,
            "collapse-tags": true
          },
          options: {
            attrs: {
              value: ""
            }
          },
          treeData: {
            attrs: {
              data: []
            },
            props: {
              children: "children",
              label: "orgName",
              value: "id"
            }
          }
        },
        {
          elType: "selectTree",
          id: "dutyUnitId",
          name: "dutyUnit",
          label: "责任单位/部门",
          attrs: {
            value: "",
            clearable: true,
            "collapse-tags": true
          },
          options: {
            attrs: {
              value: ""
            }
          },
          treeData: {
            attrs: {
              data: []
            },
            props: {
              children: "children",
              label: "orgName",
              value: "id"
            }
          }
        },
        // {
        //   elType: "dateTimePicker",
        //   id: "applyTime",
        //   label: "任务发布时间",
        //   attrs: {
        //     value: "",
        //     size: "small",
        //     type: "datetimerange",
        //     "value-format": "yyyy-MM-dd HH:mm:ss",
        //     clearable: true
        //   }
        // }
        {
          elType: "dateTimePicker",
          id: "applyTime",
          label: "计划开始时间",
          attrs: {
            value: "",
            size: "small",
            type: "datetimerange",
            "value-format": "yyyy-MM-dd HH:mm:ss",
            clearable: true
          }
        }
        // {
        //   elType: "select",
        //   id: "surveyStatus",
        //   label: "状态",
        //   attrs: {
        //     value: "",
        //     size: "small",
        //     // clearable: true,
        //     filterable: true,
        //     "collapse-tags": true
        //   }
        // }
      ],
      formDatas: [
        {
          elType: "selectTree",
          id: "acceptUnitName",
          name: "acceptUnitId",
          label: "所属单位",
          attrs: {
            value: "",
            clearable: true,
            "collapse-tags": true
          },
          options: {
            attrs: {
              value: ""
            }
          },
          treeData: {
            attrs: {
              data: []
            },
            props: {
              children: "children",
              label: "orgName",
              value: "id"
            }
          }
        },
        {
          elType: "select",
          id: "distributedUnitId",
          name: "distributedUnit",
          label: "队伍专业",
          attrs: {
            value: "",
            size: "small",
            // clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        }
      ],
      // 表格信息
      table: {
        isSelectFlag: false, // 是否展示选择器
        compRef: "gjxm",
        isSequenceFlag: true, // 是否展示序号
        isShowPage: true, // 是否展示分页
        resetFlag: true,
        loading: false,
        title: "勘察任务单列表",
        actions: [
          {}
          // {
          //   id: "dialogVisible",
          //   text: "新增",
          //   type: "primary",
          //   btnAttr: { size: "small" }
          // }
          // {
          //   id: "ListAddyp",
          //   text: "研判",
          //   type: "",
          //   btnAttr: { size: "small" }
          // }
        ],
        tableData: [],
        columns: [
          {
            prop: "surveyName",
            label: "任务单名称",
            align: "left",
            "min-width": "200px"
            // render: (h, { row }) => {
            //   return (
            //     <div>
            //       {
            //         <span
            //           style='color:#3561fd;cursor:pointer;text-decoration: underline;'
            //           {...{
            //             on: {
            //               click: () => {
            //                 this.surveyNameClick(row);
            //               }
            //             }
            //           }}
            //         >
            //           {row.surveyName}
            //         </span>
            //       }
            //     </div>
            //   );
            // }
          },
          {
            prop: "taskContent",
            label: "任务内容",
            align: "left",
            "min-width": "180px"
          },
          {
            prop: "taskAddress",
            label: "任务地点",
            align: "left",
            "min-width": "180px"
          },

          {
            prop: "distributedUnit",
            label: "派发单位/部门",
            align: "left",
            "min-width": "150px"
          },
          {
            prop: "dutyUnit",
            label: "责任单位/部门",
            align: "left",
            "min-width": "150px"
          },
          {
            prop: "dutyOfficer",
            label: "责任人",
            align: "center"
          },
          // {
          //   prop: "createTime",
          //   label: "任务发布时间",
          //   align: "center",
          //   "min-width": "95px"
          // },
          // {
          //   prop: "planFinishTime",
          //   label: "要求完成时间",
          //   align: "center",
          //   "min-width": "95px"
          // },
          {
            prop: "startTime",
            label: "计划开始时间",
            align: "center",
            "min-width": "170px"
          },
          {
            prop: "endTime",
            label: "计划结束时间",
            align: "center",
            "min-width": "170px"
          },
          {
            prop: "sourceInfo",
            label: "响应命令单",
            align: "left",
            "min-width": "230px",
            render: (h, { row }) => {
              return (
                <div>
                  {
                    <span
                      style='color:#3561fd;cursor:pointer;text-decoration: underline;'
                      {...{
                        on: {
                          click: () => {
                            this.sourceInfoClick(row);
                          }
                        }
                      }}
                    >
                      {row.sourceInfo}
                    </span>
                  }
                </div>
              );
            }
          },
          {
            prop: "surveyStatusName",
            label: "状态",
            align: "center",
            "min-width": "70px"
          },
          {
            prop: "cz",
            label: "操作",
            align: "center",
            fixed: "right",
            "min-width": "80px",
            render: (h, { row }) => {
              // const userId = JSON.parse(sessionStorage.getItem("account")).id;
              return (
                <div>
                  {
                    <span
                      style='color:#3561fd;cursor:pointer;text-decoration: underline;margin:0 10px'
                      {...{
                        on: {
                          click: () => {
                            // this.HanEdit(row);
                            this.surveyNameClick(row);
                          }
                        }
                      }}
                    >
                      {row.ztfeedback === true ? "查看" : ""}
                    </span>
                  }
                </div>
                // {row.canChooseTeam === 1 && row.dutyUnit == JSON.parse(sessionStorage.getItem("org")).ssbmName ? "选队伍" : ""}
              );
            }
            // {row.canChooseTeam === 1 && ["hb_tbr", "hb_sys"].includes(JSON.parse(sessionStorage.getItem("role")).roleCode) ? "选队伍" : ""}

          }
        ],
        // 表格样式
        tableAttr: {
          "max-height": "470px",
          height: "470px",
          stripe: false,
          border: true,
          fit: true,
          "show-header": true,
          "highlight-current-row": true,
          "cell-style": {
            "font-size": "16px"
          },
          "header-cell-style": {
            "text-align": "center",
            "background-color": "#B1C8F9",
            border: "1px solid #ccc",
            "font-size": "16px"
          }
        }
      },
      formData1: [
        {
          elType: "input",
          id: "sourceInfoId",
          label: "姓名",
          // dic: "dic_xqlb",
          attrs: {
            value: "",
            size: "small",
            // clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "select",
          id: "surveyName",
          label: "人员类型",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "select",
          id: "taskContent",
          label: "人员专业",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "select",
          id: "teamSpecialAbility",
          label: "特种作业能力",
          attrs: {
            value: "",
            size: "small",
            "collapse-tags": true
          },
          options: []
        }
      ],
      // 待命人
      dialogConfig2: {
        title: "队员选择",
        isShow: false, // 弹窗显示隐藏
        btnList: [
          {
            name: "确认",
            id: "BSubmit2", // 事件名
            type: "primary",
            size: "small"
          },
          {
            name: "取消",
            id: "Qxiao2",
            size: "small"
          }
        ]
      },
      // 分页信息
      paginationAtrrs: {
        total: 0,
        "background": true,
        layout: "prev, pager, next",
        "current-page": 1,
        "page-size": 10
      },
      activeNames: ["1", "2", "3", "4", "5"], // 折叠面板默认展开列
      form: {}, // 筛选from
      form1: {}, // 队伍选择 筛选from
      pageNum: 1,
      pageSize: 10,
      // 弹窗信息
      dialogConfig: {
        title: "队伍派遣",
        isShow: false, // 弹窗显示隐藏
        btnList: [
          {
            name: "提交",
            id: "BSubmit", // 事件名
            type: "primary",
            size: "small"
          },
          // {
          //   name: "保存",
          //   id: "submitForm",
          //   size: "small"
          // },
          {
            name: "取消",
            id: "Qxiao",
            size: "small"
          }
        ]
      },
      dialogConfig1: {
        title: "队伍选择",
        isShow: false, // 弹窗显示隐藏
        btnList: [
          {
            name: "确认",
            id: "BSubmit1", // 事件名
            type: "primary",
            size: "small"
          },
          {
            name: "取消",
            id: "Qxiao1",
            size: "small"
          }
        ]
      },
      // 折叠面板信息
      titleConfig: [
        {
          title: "信息来源",
          name: "1",
          slot: "slot1"
        },
        {
          title: "任务信息",
          name: "2",
          slot: "slot2"
        },
        {
          title: "队伍信息",
          name: "3",
          slot: "slot3"
        },
        {
          title: "填报信息",
          name: "4",
          slot: "slot4"
        }
      ],
      // 弹窗表单信息
      formConfig: {
        // disabled: true,
        formData: [
          {
            type: "select",
            label: "响应命令单",
            prop: "sourceInfoId",
            name: "sourceInfo",
            // dic: "dic_xxly",
            class: "sjgy",
            isDisabled: true,
            lableWidth: "120px",
            option: []
          }
        ]
      },
      // 弹窗表单信息
      formConfig1: {
        // disabled: true,
        formData: [
          {
            type: "input",
            label: "任务单名称",
            prop: "surveyName",
            class: "half",
            isDisabled: true,
            lableWidth: "130px"
          },
          {
            type: "select",
            label: "专业类型",
            prop: "taskType",
            name: "taskTypeName",
            dic: "dic_kclx",
            class: "half",
            isDisabled: true,
            lableWidth: "130px",
            option: []
          },
          {
            type: "select",
            label: "派发单位/部门",
            prop: "distributedUnitId",
            name: "distributedUnit",
            // dic: "dic_yjjb",
            class: "half",
            isDisabled: true,
            lableWidth: "130px",
            option: []
          },
          {
            type: "select",
            label: "责任单位/部门",
            prop: "dutyUnitId",
            name: "dutyUnit",
            // dic: "dic_yjjb",
            class: "half",
            isDisabled: true,
            lableWidth: "130px",
            option: []
          },

          // {
          //   type: "dataPicker",
          //   label: "要求完成时间",
          //   prop: "planFinishTime",
          //   class: "half",
          //   isDisabled: true,
          //   dateType: "datetime",
          //   lableWidth: "130px"
          // },
          {
            type: "dataPicker",
            label: "计划开始时间",
            prop: "startTime",
            class: "half",
            dateType: "datetime",
            isDisabled: true,
            lableWidth: "130px"
          },
          {
            type: "dataPicker",
            label: "计划结束时间",
            prop: "endTime",
            class: "half",
            dateType: "datetime",
            isDisabled: true,
            lableWidth: "130px"
          },
          {
            type: "select",
            label: "派发人",
            prop: "dispatcherId",
            name: "dispatcher",
            // dic: "dic_kclx",
            class: "half",
            isDisabled: true,
            lableWidth: "130px",
            option: []
          },
          {
            type: "select",
            label: "责任人",
            prop: "dutyOfficerId",
            name: "dutyOfficer",
            // dic: "dic_yjjb",
            class: "half",
            isDisabled: true,
            lableWidth: "130px",
            option: []
          },
          {
            type: "input",
            label: "任务地点",
            prop: "taskAddress",
            class: "half",
            isDisabled: true,
            lableWidth: "130px"
          },
          {
            type: "input",
            label: "任务内容",
            prop: "taskContent",
            class: "sjgy",
            isDisabled: true,
            lableWidth: "130px"
          }
        ]
      },
      // 弹窗表单信息
      formConfig2: {
        formData: [
          {
            type: "btnInput",
            label: "选择队伍",
            value: "请选择",
            prop: "emergencyEvent",
            // class: "iputsse",
            class: "half",
            lableWidth: "130px"
          },
          {
            type: "input",
            label: "需求人数",
            prop: "needNumberOfPeople",
            // class: "sjgy",
            class: "half",
            lableWidth: "140px"
          }
        ]
      },
      // 填报信息
      formConfig3: {
        // disabled: true,
        formData: [
          {
            type: "input",
            label: "填报人",
            prop: "creator",
            class: "third",
            isDisabled: true,
            lableWidth: "130px"
          },
          {
            type: "input",
            label: "单位及部门",
            class: "third",
            isDisabled: true,
            prop: "creatorUnit",
            lableWidth: "130px"
          },
          {
            type: "input",
            label: "填报时间",
            class: "third",
            prop: "createTime",
            isDisabled: true,
            lableWidth: "130px"
          }
        ]
      },
      // 选择队伍列表数据
      WeatherForecasts: {
        isSelectFlag: true, // 是否展示选择器
        compRef: "gjxm",
        isSequenceFlag: true, // 是否展示序号
        isShowPage: true, // 是否展示分页
        resetFlag: true,
        loading: false,
        title: "",
        multiple: false,
        actions: [
        ],
        tableData: [],
        columns: [
          {
            prop: "unit",
            label: "所属单位",
            align: "left",
            "min-width": "180px"
          },
          {
            prop: "teamName",
            label: "队伍名称",
            align: "left",
            "min-width": "140px"
          },
          {
            prop: "teamTypeName",
            label: "队伍类型",
            align: "center"
          },
          {
            prop: "teamMajor",
            label: "队伍专业",
            align: "center"
          },

          {
            // prop: "teamStatusName",
            prop: "occupation",
            label: "队伍状态",
            align: "center",
            formatter: (row, column, cellValue, index) => {
              if (cellValue === 0) {
                return "待命";
              } else if (cellValue === 1) {
                return "已调配";
              }
            }
          },
          {
            prop: "captainName",
            label: "队长名称",
            align: "center"
          },
          {
            prop: "contactWay",
            label: "联系方式",
            align: "center"
          },
          {
            prop: "standbyStaff",
            label: "待命人数",
            align: "center",
            fixed: "right",
            "min-width": "80px",
            render: (h, { row }) => {
              return (
                <div>
                  {
                    <span
                      // style='color:#3561fd;cursor:pointer;text-decoration: underline;margin:0 10px'
                      {...{
                        on: {
                          click: () => {
                            // this.handleRanks111(row);
                          }
                        }
                      }}
                    >
                      {row.standbyStaff}
                    </span>
                  }
                </div>
              );
            }
          }
        ],
        // 表格样式
        tableAttr: {
          "max-height": "470px",
          // height: "470px",
          stripe: false,
          border: true,
          fit: true,
          "show-header": true,
          "highlight-current-row": true,
          "cell-style": {
            "font-size": "16px"
          },
          "header-cell-style": {
            "text-align": "center",
            "background-color": "#B1C8F9",
            border: "1px solid #ccc",
            "font-size": "16px"
          }
        },
        paginationAtrrs: {
          total: 0,
          "background": true,
          layout: "prev, pager, next",
          "current-page": 1,
          "page-size": 10
        }
      },
      // 选择队伍后回显 tab表格
      WeatherForecasts1: {
        isSelectFlag: false, // 是否展示选择器
        compRef: "gjxm",
        isSequenceFlag: true, // 是否展示序号
        isShowPage: true, // 是否展示分页
        resetFlag: true,
        loading: false,
        title: "",
        actions: [
        ],
        tableData: [],
        columns: [
          {
            // prop: "unit",
            prop: "unit",
            label: "所属单位",
            align: "center",
            "min-width": "230px"
          },
          {
            prop: "member",
            label: "姓名",
            align: "center",
            "min-width": "200px"
          },
          {
            prop: "contact",
            label: "联系方式",
            align: "center"
          },
          {
            prop: "type",
            label: "人员类型",
            align: "center"
          },
          {
            prop: "major",
            label: "人员专业",
            align: "center"
          },
          {
            prop: "ability",
            label: "特种作业能力",
            align: "center"
          },
          {
            prop: "checkInDate",
            label: "入岗时间",
            align: "center"
          }
        ],
        // 表格样式
        tableAttr: {
          "max-height": "470px",
          // height: "470px",
          stripe: false,
          border: true,
          fit: true,
          "show-header": true,
          "highlight-current-row": true,
          "cell-style": {
            "font-size": "16px"
          },
          "header-cell-style": {
            "text-align": "center",
            "background-color": "#B1C8F9",
            border: "1px solid #ccc",
            "font-size": "16px"
          }
        },
        paginationAtrrs: {
          total: 0,
          "background": true,
          layout: "prev, pager, next",
          "current-page": 1,
          "page-size": 10
        }
      },
      TeamSelection: {
        isSelectFlag: true, // 是否展示选择器
        compRef: "gjxm",
        isSequenceFlag: true, // 是否展示序号
        isShowPage: true, // 是否展示分页
        resetFlag: true,
        loading: false,
        title: "",
        actions: [
          // {
          //   id: "dialogVisible",
          //   text: "新增",
          //   type: "primary",
          //   btnAttr: { size: "small" }
          // }
          // {
          //   id: "ListAddyp",
          //   text: "研判",
          //   type: "",
          //   btnAttr: { size: "small" }
          // }
        ],
        tableData: [],
        columns: [
          {
            // prop: "unit",
            prop: "accessUnit",
            label: "所属单位",
            align: "center",
            "min-width": "120px"
          },
          {
            prop: "name",
            label: "姓名",
            align: "center"
          },
          {
            prop: "contact",
            label: "联系方式",
            align: "center"
          },
          {
            prop: "memberType",
            label: "人员类型",
            align: "center"
          },

          {
            prop: "memberMajor",
            label: "人员专业",
            align: "center"
          },
          {
            prop: "memberAbility",
            label: "特种作业能力",
            align: "center"
          },
          {
            prop: "entryTime",
            label: "入岗时间",
            align: "center"
          }
        ],
        // 表格样式
        tableAttr: {
          "min-height": "470px",
          // height: "470px",
          stripe: false,
          border: true,
          fit: true,
          "show-header": true,
          "highlight-current-row": true,
          "cell-style": {
            "font-size": "16px"
          },
          "header-cell-style": {
            "text-align": "center",
            "background-color": "#B1C8F9",
            border: "1px solid #ccc",
            "font-size": "16px"
          }
        },
        paginationAtrrs: {
          total: 0,
          "background": true,
          layout: "prev, pager, next",
          "current-page": 1,
          "page-size": 10
        }
      },
      duiwuId: "", // 选择后的队伍 id
      multipleSelection2: [], // 单选全选
      teamSelection: 0, // 队伍 已选人数
      choiceNum: 0 // 队员已选人数
    };
  },
  watch: {
  },
  mounted() {
    // console.log(this.$route.query.surveyStatus);
    const FilledBy = {
      creator: JSON.parse(sessionStorage.getItem("account")).realName,
      creatorId: JSON.parse(sessionStorage.getItem("account")).id,
      deptId: JSON.parse(sessionStorage.getItem("org")).orgCode,
      unitDeptName: JSON.parse(sessionStorage.getItem("org")).orgName,
      creatorUnit: JSON.parse(sessionStorage.getItem("org")).orgName,
      createTime: new Date().toLocaleString(),
      approvalUserId: JSON.parse(sessionStorage.getItem("account")).id,
      approvalUser: JSON.parse(sessionStorage.getItem("account")).realName,
      pprovalDeptId: JSON.parse(sessionStorage.getItem("org")).orgCode,
      approvalDept: JSON.parse(sessionStorage.getItem("org")).orgName,
      approvalTime: new Date().toLocaleString()
    };
    this.FilledBy = FilledBy;
    this.list();
    this.getFormInput();
    this.getInputVal();
  },
  methods: {
    handleupdata(val) {
      console.log(val);
    },
    // 清空选中的数据
    handleBtnInput(item) {
      this.formConfig2.formData.map(i => {
        if (i.label === "选择队伍") {
          i.value = "请选择";
        }
      });
    },
    //  点击分页查询队伍信息， 单独拿出来
    async getduiwuranksDataList(pageNum, pageSize) {
      const parmas = {
        pageNum: pageNum,
        pageSize: pageSize
      };
      const res = await ranksDataList(parmas);
      // this.TeamSelection.tableData = res.data;
      // this.TeamSelection.paginationAtrrs.total = res.total;
      this.WeatherForecasts.tableData = res.data;
      this.WeatherForecasts.paginationAtrrs.total = res.total;
    },
    //  点击分页查询队员信息， 单独拿出来
    async getduiyuanData(pageNum, pageSize) {
      const parmas = {
        pageNum: pageNum,
        pageSize: pageSize,
        teamId: this.teamId,
        occupation: 0
      };
      const res = await duiyuanDataList(parmas);
      this.TeamSelection.tableData = res.data;
      this.TeamSelection.paginationAtrrs.total = res.total;
    },
    // 待命人数
    async handleRanks111(val) {
      this.StandbyId = val.id;
      this.dialogConfig2.isShow = true;
      this.duiwuId = val.id;
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        teamId: val.id,
        occupation: 0
      };
      const res = await duiyuanDataList(parmas);
      this.duiwuName = res.data[0].teamName;
      // this.duiwuId = res.data[0].id;
      this.formConfig2.formData.map(item1 => {
        // console.log(item1)
        if (item1.label === "选择队伍") {
          item1.value = this.duiwuName;
        }
      });
      this.TeamSelection.tableData = res.data;
      this.TeamSelection.paginationAtrrs.total = res.total;
    },
    // 取消
    Qxiao2() {
      // console.log("取消www");
      this.duiwuName = "";
    },
    // 待命人数确定
    // BSubmit2() {
    //   // console.log(this.multipleSelection2)
    //   if (this.multipleSelection2.length <= 0) {
    //     this.$message({
    //       message: "请至少选择一条数据",
    //       type: "warning"
    //     });
    //     return;
    //   } else if (this.multipleSelection2.length >= 1) {
    //     this.WeatherForecasts1.tableData = this.multipleSelection2;
    //     this.WeatherForecasts1.paginationAtrrs.total = this.multipleSelection2.length;
    //     this.ranksList = this.multipleSelection2;
    //     this.dialogConfig2.isShow = false;
    //     this.dialogConfig1.isShow = false;
    //   }
    // },
    BSubmit2() {
      console.log("人员确定");
      console.log(this.multipleSelection2);
      if (this.multipleSelection2.length <= 0) {
        this.$message({
          message: "请至少选择一条数据",
          type: "warning"
        });
      } else if (this.multipleSelection2.length >= 1) {
        this.WeatherForecasts1.tableData = this.multipleSelection2.map(item => {
          return {
            surveyId: this.editId || "", // 灾情勘察主键ID
            memberId: item.id, // 人员id
            member: item.name, // 人员名称
            unit: item.unit, // 所属单位
            type: item.memberType, // 人员类型
            contact: item.contact, // 联系方式
            major: item.memberMajor, // 人员专业
            ability: item.memberAbility, // 特种作业能力
            checkInDate: item.entryTime // 入岗时间
          };
        });
        //
        // this.WeatherForecasts1.tableData = this.multipleSelection2;
        this.WeatherForecasts1.paginationAtrrs.total = this.multipleSelection2.length;
        this.ranksList = this.multipleSelection2;
        this.duiwuData = this.multipleSelection2;
        this.dialogConfig2.isShow = false;
        this.dialogConfig1.isShow = false;
        const ids = this.WeatherForecasts1.tableData.map(i => i.id);
        this.$set(this.WeatherForecasts1.tableData, "smallId", ids);
      }
    },
    // 队员弹窗选择
    handleSelectionChange2(val) {
      this.multipleSelection2 = val;
      this.choiceNum = val.length;
    },
    handleBtn2(item) {
      this[item.id]();
    },
    //  响应命令单选择的数据
    handleChange(val) {
      // 获取选中的 名称和id
      this.formConfig.formData[0].option.forEach(i => {
        if (i.value === val) {
          // console.log(i)
          this.valueNameId = i;
          // console.log(this.valueNameId)
        }
      });

    },
    handleChange1(val) {
      // console.log(val)
    },
    // 弹窗按钮点击事件 对应id绑定事件
    handleBtn(item) {
      this[item.id]();
    },
    handleBtn1(item) {
      this[item.id]();
    },
    // 重置
    reset() {
      this.form = this.$options.data().form;
      this.pageNum = 1;
      this.$refs.gjxm.paginationAtrrsInner["current-page"] = 1;
      this.list();
    },
    // 列表
    async list() {
      var status = "";
      if (this.$route.query.surveyStatus == "kong") {
        status = "";
      } else if (this.$route.query.surveyStatus == "4") {
        status = "4";
      } else {
        status = "2,4";
      }
      // console.log(status, "状态值");
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        surveyStatus: status,
        sourceInfoId: this.$route.query.sourceInfoId || ""
      };
      // const res = await fankuiListPage(parmas);
      const res = await zqkcFeedbackList(parmas);
      this.table.tableData = res.data;
      this.paginationAtrrs.total = res.total;
    },
    // 检索
    async query(val) {
      var status = "";
      if (this.$route.query.surveyStatus == "kong") {
        status = "";
      } else if (this.$route.query.surveyStatus == "4") {
        status = "4";
      } else {
        status = "2,4";
      }
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        surveyStatus: status, // 接收
        // surveyStatus: this.$route.query.surveyStatus === "" || this.$route.query.surveyStatus === undefined ? "4" : "2,4", // 接收
        surveyName: this.form.surveyName,
        taskContent: this.form.taskContent,
        taskAddress: this.form.taskAddress,
        sourceInfoId: this.form.sourceInfoId,
        // distributedUnitId: val.distributedUnitId && val.distributedUnitId[val.distributedUnitId.length - 1],
        // dutyUnitId: val.dutyUnitId && val.dutyUnitId[val.dutyUnitId.length - 1],
        dutyUnitId: val.dutyUnit,
        distributedUnitId: val.distributedUnit,
        taskPublishTimeStart: val.applyTime ? val.applyTime[0] : "", // 开始时间
        taskPublishTimeEnd: val.applyTime ? val.applyTime[1] : "" // 结束时间

      };
      // const res = await fankuiListPage(parmas);
      const res = await zqkcFeedbackList(parmas);
      this.table.tableData = res.data;
      this.paginationAtrrs.total = res.total;
    },

    // 保存
    async submitForm() {
      console.log(this.valueNameId.label);
      console.log(this.type);
      const parmas = {
        surveyId: this.editId, // 编辑 / 详情 id
        teamId: this.duiwuId // 选择队伍
      };
      const res = await chooseTeamAdd(parmas);
      if (res) {
        this.$message({
          message: "保存成功",
          type: "success"
        });
        this.list();
        this.dialogConfig.isShow = false;
      }

    },
    // 提交
    async BSubmit() {
      console.log(this.$refs.formComponent2.form.needNumberOfPeople);
      console.log(this.ranksList, "shuju");
      const hahaha = this.ranksList.map(item => {
        return {
          surveyId: this.editId || "", // 灾情勘察主键ID
          memberId: item.id, // 人员id
          member: item.name, // 人员名称
          unit: item.unit, // 所属单位
          type: item.memberType, // 人员类型
          contact: item.contact, // 联系方式
          major: item.memberMajor, // 人员专业
          ability: item.memberAbility, // 特种作业能力
          checkInDate: item.entryTime // 入岗时间
        };
      });
      // console.log(hahaha,"shuju")
      const parmas = {
        id: this.editId, // 编辑 / 详情 id
        surveyTeamId: this.StandbyId, // 队伍id
        surveyTeamName: this.duiwuName, // 队伍名称
        memberSaveDto: hahaha, // 勘察队伍人员
        needNumberOfPeople: this.$refs.formComponent2.form.needNumberOfPeople
      };
      // const res = await chooseTeamAdd(parmas);
      const res = await zqkcFeedbackUpdate(parmas);
      if (res) {
        this.$message({
          message: "提交成功",
          type: "success"
        });
        this.list();
        this.dialogConfig.isShow = false;
      }
    },
    empty() {
      this.$refs.formComponent.form = this.$refs.formComponent.$options.data().form;
      this.$refs.formComponent1.form = this.$refs.formComponent1.$options.data().form;
      this.$refs.formComponent2.form = this.$refs.formComponent2.$options.data().form;
      this.$refs.formComponent3.form = this.$refs.formComponent3.$options.data().form;
      // this.$refs.formComponent4.form = this.$refs.formComponent4.$options.data().form
      this.$nextTick(() => {
        this.$refs.formComponent.$refs.formInlines.clearValidate();
        this.$refs.formComponent1.$refs.formInlines.clearValidate();
        this.$refs.formComponent2.$refs.formInlines.clearValidate();
        this.$refs.formComponent3.$refs.formInlines.clearValidate();
        // this.$refs.formComponent4.$refs.formInlines.clearValidate()

      });
    },
    // 弹窗关闭图标
    close() {
      // this.formConfig2.formData.map(item1 => {
      //   console.log(item1);
      //   if (item1.label === "选择队伍") {
      //     item1.value = "";
      //   }
      // });
      this.duiwuName = "";
      this.duiwuId = "";
      this.formConfig2.formData[0].value = "";
      this.dialogConfig.isShow = false;
    },
    // 弹窗关闭图标
    close1() {
      this.form1 = this.$options.data().form1;
      this.dialogConfig1.isShow = false;
    },
    close2() {
      this.dialogConfig2.isShow = false;
    },
    // 获取表单下拉框
    getFormInput() {
      // 筛选
      this.formData.forEach((item) => {
        console.log();
        // if (item.id === "distributedUnitId") { // 派发单位/部门
        //   GetOrgTree().then(res => {
        //     item.options = res;
        //   });
        // }
        // if (item.id === "dutyUnitId") { // 责任单位/部门
        //   GetOrgTree().then(res => {
        //     item.options = res;
        //   });
        // }
        if (item.elType === "selectTree") {
          // GetOrgTree().then(res => {
          //   this.$nextTick(() => {
          //     if (item.label === "派发单位/部门") {
          //       this.$set(this.formData[4].treeData.attrs, "data", res);
          //     } else if (item.label === "责任单位/部门") {
          //       this.$set(this.formData[5].treeData.attrs, "data", res);
          //     }
          //     // this.$set(this.config.formData[5].treeData.attrs, "data", res)
          //   });
          //   // console.log(this.selectTreeList, "selectTreeListselectTreeListselectTreeList");
          // });
          getOrggetSameLevel({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            this.$nextTick(() => {
              if (item.label === "派发单位/部门") {
                this.$set(this.formData[4].treeData.attrs, "data", res);
              }
            });
          });
          getOrggetSameLevel({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            this.$nextTick(() => {
              if (item.label === "责任单位/部门") {
                this.$set(this.formData[5].treeData.attrs, "data", res);
              }
            });
          });
        }
      });
      this.formDatas.forEach((item) => { // 队伍选择 所属单位
        if (item.elType === "selectTree") {
          GetOrgTree().then(res => {
            item.treeData.attrs.data = res;
          });
        }
        // if (item.id === "acceptUnitId") {
        //   GetOrgTree().then(res => {
        //     item.options = res;
        //   });
        // }
        if (item.id === "distributedUnitId") {
          listTeamType({ type: "teamMajor" }).then(res => {
            const option = res.map((i) => {
              return {
                label: i.name,
                value: Number(i.code)
              };
            });
            item.options = option;
          });
        }
      });
      this.formData1.forEach((item) => {
        if (item.id === "surveyName") { // 人员类型
          listTeamType({ type: "person" }).then(res => {
            const option = res.map((i) => {
              return {
                label: i.name,
                value: Number(i.code)
              };
            });
            item.options = option;
          });
        }
        if (item.id === "taskContent") { // 人员专业
          listTeamType({ type: "teamMajor" }).then(res => {
            const option = res.map((i) => {
              return {
                label: i.name,
                value: Number(i.code)
              };
            });
            item.options = option;
          });
        }
        if (item.id === "teamSpecialAbility") { // 人员专业
          listTeamType({ type: "teamSpecialAbility" }).then(res => {
            const option = res.map((i) => {
              return {
                label: i.name,
                value: Number(i.code)
              };
            });
            item.options = option;
          });
        }
      });


    },
    // 获取下拉框数据
    getInputVal() {
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      };
      this.formData.map(item => {
        if (item.label === "响应命令单") {
          xymldSubmissionList(parmas).then(res => {
            const option = res.data.map((item) => {
              // console.log(item)
              var sourceInfo = item.responseName;
              return {
                label: sourceInfo,
                value: item.id
              };
            });
            item.options = option;

          });
        }
      });
      this.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then(res => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: Number(item.dicCode)
              };
            });
            item.options = option;
          });
        }
      });
      this.formConfig.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then(res => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: Number(item.dicCode)
              };
            });
            item.option = option;
          });
        }
      });
      this.formConfig1.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then(res => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: Number(item.dicCode)
              };
            });
            item.option = option;
          });
        }
      });
    },

    // 点击选择队伍选择
    // async getResourcesData() {
    //   this.dialogConfig1.isShow = true;
    //   const parmas = {
    //     pageNum: this.pageNum,
    //     pageSize: this.pageSize
    //   };
    //   const res = await ranksDataList(parmas);
    //   console.log(res.data);
    //   this.WeatherForecasts.tableData = res.data;
    //   this.WeatherForecasts.paginationAtrrs.total = res.total;
    // },
    async getResourcesData() {
      console.log("选择111pppp");
      this.dialogConfig1.isShow = true;
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize
      };
      const res = await ranksDataList(parmas);
      this.WeatherForecasts.tableData = res.data;
      this.WeatherForecasts.paginationAtrrs.total = res.total;
      const result = this.WeatherForecasts1.tableData.bigId || [];
      if (result.length > 0) {
        this.$nextTick(() => {
          this.$refs.teamTable.toggleSelection(result);
        });
      }
    },
    // 抛出列表按钮
    onActionClick(item, index) {
      this[item.id](); // 调用按钮对应方法
    },
    // 取消
    Qxiao() {
      this.duiwuName = "";
      this.duiwuId = "";
      this.formConfig2.formData[0].value = "";
      this.$refs.formComponent.form = this.$refs.formComponent.$options.data().form;
      this.$refs.formComponent1.form = this.$refs.formComponent1.$options.data().form;
      this.$refs.formComponent2.form = this.$refs.formComponent2.$options.data().form;
      this.$refs.formComponent3.form = this.$refs.formComponent3.$options.data().form;
      // this.$refs.formComponent4.form = this.$refs.formComponent4.$options.data().form
      this.$nextTick(() => {
        this.$refs.formComponent.$refs.formInlines.clearValidate();
        this.$refs.formComponent1.$refs.formInlines.clearValidate();
        this.$refs.formComponent2.$refs.formInlines.clearValidate();
        this.$refs.formComponent3.$refs.formInlines.clearValidate();
        // this.$refs.formComponent4.$refs.formInlines.clearValidate()

      });
    },
    // 取消
    Qxiao1() {
      console.log("取消ll");
      this.duiwuName = "";
      this.dialogConfig1.isShow = false;
      // this.ranksList = [];
      // console.log(this.ranksList);
    },
    // 队伍选择  查询
    async ranksQuery(val) {
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        // unitId: val.acceptUnitId ? val.acceptUnitId[1] : "",
        // teamMajor: val.distributedUnitId
        unit: val.acceptUnitName,
        teamMajor: val.distributedUnit
      };
      const res = await ranksDataList(parmas);
      console.log(res);
      this.WeatherForecasts.tableData = res.data;
      this.WeatherForecasts.paginationAtrrs.total = res.total;

    },
    // 队伍选择  重置
    ranksResetForm() {
      console.log("重置1");
      this.form1 = this.$options.data().form1;
      this.getResourcesData();
    },
    // 队员选择  查询
    async onSubmitQuery(val) {
      console.log("查询");
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        occupation: 0,
        name: val.sourceInfoId, // 姓名
        memberType: val.surveyName, // 人员类型
        memberMajor: val.taskContent, //  人员专业
        memberAbility: val.teamSpecialAbility // 	特种作业能力
      };
      const res = await duiyuanDataList(parmas);
      this.TeamSelection.tableData = res.data;
      this.TeamSelection.paginationAtrrs.total = res.total;
    },
    // 队员选择  重置
    async resetFormQuery() {
      console.log("重置");
      this.form = this.$options.data().form;
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize,
        occupation: 0,
        teamId: this.StandbyId
      };
      const res = await duiyuanDataList(parmas);
      this.duiwuName = res.data[0].teamName;
      this.duiwuId = res.data[0].id;
      this.formConfig2.formData.map(item1 => {
        // console.log(item1)
        if (item1.label === "选择队伍") {
          item1.value = this.duiwuName;
        }
      });
      this.TeamSelection.tableData = res.data;
      this.TeamSelection.paginationAtrrs.total = res.total;
    },
    async BSubmit1() {
      if (this.ranksList[0].standbyStaff <= "0") {
        this.$message({
          message: "当前待命人数为0，请选择其他队伍！",
          type: "warning"
        });
        return;
      }
      this.dialogConfig1.isShow = false;
      this.ranksList.map(item => {
        // console.log(item.unit)
        this.duiwuName = item.teamName;
        this.duiwuId = item.id;
        console.log(this.duiwuId);
      });
      this.formConfig2.formData.map(item1 => {
        // console.log(item1)
        if (item1.label === "选择队伍") {
          item1.value = this.duiwuName;
        }
      });
      const res = await duiyuanDataList({ teamId: this.duiwuId });
      console.log(res.data, "ppp");
      this.ranksList = res.data; // 只选择队伍时数据
      // this.WeatherForecasts1.tableData = res.data;
      // console.log(this.WeatherForecasts1.tableData);
      this.WeatherForecasts1.tableData = res.data.map(item => {
        return {
          surveyId: this.editId || "", // 灾情勘察主键ID
          memberId: item.id, // 人员id
          member: item.name, // 人员名称
          unit: item.unit, // 所属单位
          contact: item.contact, // 联系方式
          major: item.memberMajor, // 人员专业
          type: item.memberType, // 人员类型
          ability: item.memberAbility, // 特种作业能力
          checkInDate: item.entryTime // 入岗时间
        };
      });
      this.WeatherForecasts1.paginationAtrrs.total = res.total;
      // 获取回显 勾显时的id
      const ids = [this.duiwuId];
      const personids = this.WeatherForecasts1.tableData.map(i => i.id);
      this.$set(this.WeatherForecasts1.tableData, "bigId", ids);
      this.$set(this.WeatherForecasts1.tableData, "smallId", personids);
    },
    handleSelectTree(arg, item) {
      if (item.id === "acceptUnitName") {
        this.$set(this.form1, "acceptUnitId", arg[0].id);
        this.$set(this.form1, "acceptUnitName", arg[0].orgName);
      } else if (item.id === "dutyUnit") {
        this.$set(this.form, "dutyUnitCode", arg[0].id);
        this.$set(this.form, "dutyUnit", arg[0].orgName);
      }
      //  else if (item.id === "dutyUnit") {
      //   this.$set(this.form, "distributeTaskId", arg[0].orgCode)
      //   this.$set(this.form, "distributeDept", arg[0].orgName)
      // }
      // console.log(arg, "?????arg");
      // console.log(item, "?????item");
    },
    // 新增
    dialogVisible() {
      this.dialogConfig.isShow = true;
      const parmas = {
        pageNum: this.pageNum,
        pageSize: this.pageSize
        // surveyStatus: 0
      };
      this.formConfig.formData.map(item => {
        if (item.label === "响应命令单") {
          xymldSubmissionList(parmas).then(res => {
            const option = res.data.map((item) => {
              // console.log(item)
              var sourceInfo = item.responseName;
              return {
                label: sourceInfo,
                value: item.id
              };
            });
            item.option = option;

          });
        }
      });
      // 派发单位/部门
      // this.formConfig1.formData.map(item => {
      //   if (item.label === "派发单位/部门") {
      //     BaseMockDepartment().then(data => {
      //       item.option = this.getOption(data);
      //     });
      //   }
      // });
      // 责任单位/部门
      // this.formConfig1.formData.map(item => {
      //   if (item.label === "责任单位/部门") {
      //     BaseMockDepartment().then(res => {
      //       item.option = this.getOption1(res);

      //     });
      //   }
      // });
      // 责任人
      this.formConfig1.formData.map(item => {
        if (item.label === "责任人") {
          BaseMockPerson().then(res => {
            const option = res.map((item) => {
              return {
                label: item.realName,
                value: item.id
              };
            });
            item.option = option;
          });
        }
      });

    },
    getOption(val) {
      const arr = val.map(i => {
        if (i.children) {
          return {
            label: i.orgName,
            value: i.orgCode,
            children: this.getOption(i.children)
          };
        } else {
          return {
            label: i.orgName,
            value: i.orgCode
          };
        }
      });
      console.log(arr, "??????????arr");
      return arr;
    },
    getOption1(val) {
      const arr = val.map(i => {
        if (i.children) {
          return {
            label: i.orgName,
            value: i.orgCode,
            children: this.getOption(i.children)
          };
        } else {
          return {
            label: i.orgName,
            value: i.orgCode
          };
        }
      });
      return arr;
    },
    // 响应命令单名称
    sourceInfoClick(val) {
      this.$router.push({
        name: "EmergencyResponseinfo",
        query: { id: val.sourceInfoId }
      });
    },
    // 任务单名称
    surveyNameClick(val) {
      if (val.taskType === "1") {
        this.$router.push({
          name: "StatisticalDetails", // 基干勘察详情
          query: { id: val.id, emergencyId: val.emergencyId }
        });
      } else if (val.taskType === "2") {
        this.$router.push({
          name: "TransmissionDetails", // 输电
          query: { id: val.id, emergencyId: val.emergencyId }
        });
      } else if (val.taskType === "3") {
        this.$router.push({
          name: "PowerTransformationDetails", // 变电
          query: { id: val.id, emergencyId: val.emergencyId }
        });
      } else if (val.taskType === "4") {
        this.$router.push({
          name: "PowerDistributionDetails", // 配电
          query: { id: val.id, emergencyId: val.emergencyId }
        });
      } else if (val.taskType === "5") {
        this.$router.push({
          name: "MarketingDetails", // 营销
          query: { id: val.id, emergencyId: val.emergencyId }
        });
      } else {
        this.$message({
          message: "任务类型为空，无法查看详情！",
          type: "warning"
        });
        return;
      }
    },
    // 列表组织机构查询
    handleSelectTreeTabulation(arg, item) {
      if (item.id === "distributedUnitId") {
        this.$set(this.form, "distributedUnit", arg[0].id);
        this.$set(this.form, "distributedUnitId", arg[0].orgName);
      } else if (item.id === "dutyUnitId") {
        this.$set(this.form, "dutyUnit", arg[0].id);
        this.$set(this.form, "dutyUnitId", arg[0].orgName);
      }
    },
    // 选择器
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // handleSelectionChange1() {
    //   // this.ranksList = val;
    //   // console.log(this.ranksList, "队伍选择");
    // },
    // 队伍弹窗选择人员数量
    handleSelectionChange3(val) {
      console.log(val, "ppppp");
      this.ranksList = val;
      this.StandbyId = val[0].id;
      this.teamName = val[0].teamName;
      this.teamSelection = val[0].standbyStaff;
    },
    // 选队伍
    HanEdit(id) {
      console.log(id);
      this.dialogVisible();
      this.editId = id.id;
      this.dialogConfig.isShow = true;
      zqkcFeedbackDetail({ id: id.id }).then(res => {

        // if (res.surveyTeam === "" || res.surveyTeam === null) {
        //   this.duiwuName = "";
        // } else {
        //   this.duiwuName = res.surveyTeam.teamName;
        // }
        // // console.log(this.duiwuName);

        // this.formConfig2.formData.map(item1 => {
        //   if (item1.label === "选择队伍") {
        //     item1.value = this.duiwuName;
        //   }
        // });
        // const parmas = {
        //   pageNum: 1,
        //   pageSize: 10,
        //   teamId: res.surveyTeam === null || "" ? "" : res.surveyTeam.id
        //   // occupation: 0
        // };
        // setTimeout(() => {
        //   if (res.surveyTeam !== null || "") {
        //     duiyuanDataList(parmas).then(item => {
        //       this.WeatherForecasts1.tableData = item.data;
        //       this.WeatherForecasts1.paginationAtrrs.total = item.total;
        //       this.ranksList = item.data;
        //       const ids = this.WeatherForecasts1.tableData.map(i => i.id);
        //       this.$set(this.WeatherForecasts1.tableData, "smallId", ids);
        //     });
        //   }
        // });
        if (res.surveyTeamName === "" || res.surveyTeamName === null) {
          this.duiwuName = "";
        } else {
          this.duiwuName = res.surveyTeamName || "";// 将详情中队伍名称存起来
          this.duiwuId = id.surveyTeamId || ""; // 将详情中队伍id存起来
        }
        // console.log(this.duiwuName);
        this.formConfig2.formData.map(item1 => {
          if (item1.label === "选择队伍") {
            item1.value = this.duiwuName;
          }
        });
        const parmas = {
          pageNum: 1,
          pageSize: 10,
          surveyId: id.id
          // occupation: 0
        };
        setTimeout(() => {
          if (res.surveyTeam !== null || "") {
            // duiyuanDataList(parmas).then(item => {
            getSelectedMember(parmas).then(item => {
              console.log(item);
              this.WeatherForecasts1.tableData = item.data;
              this.WeatherForecasts1.paginationAtrrs.total = item.total;
              this.ranksList = item.data;
              const ids = this.WeatherForecasts1.tableData.map(i => i.id);
              this.$set(this.WeatherForecasts1.tableData, "smallId", ids);
            });
          }
        });
        //
        this.type = 1;
        this.$refs.formComponent.form = res;
        this.$refs.formComponent1.form = res;
        this.$set(this.$refs.formComponent1.form, "dispatcher", this.FilledBy.creator);

        this.$refs.formComponent2.form = res;
        this.$refs.formComponent3.form = res;
        console.log(this.$refs.formComponent3.form, "单位及部门");
        // this.$refs.formComponent4.form = res
        this.ranksList = res.surveyTeam;
        this.$set(this.$refs.formComponent1.form, "yxTime", [res.effectStartTime, res.effectEndTime]);
      });
    },
    handleClose(done) {
      console.log(done);

    },
    // 分页
    handleSizeChange(val) {
      this.pageNum = val["current-page"];
      this.pageSize = val["page-size"];
      this.list();
    },
    // 选择队伍后的列表分页
    handleSize(val) {
      duiyuanDataList({
        teamId: this.duiwuId,
        pageNum: val["current-page"],
        pageSize: val["page-size"]
      }).then(res => {
        this.duiwuData = res.data;
        this.WeatherForecasts1.tableData = res.data.map(item => {
          return {
            surveyId: this.editId || "", // 灾情勘察主键ID
            memberId: item.id, // 人员id
            member: item.name, // 人员名称
            unit: item.unit, // 所属单位
            contact: item.contact, // 联系方式
            major: item.memberMajor, // 人员专业
            type: item.memberType, // 人员类型
            ability: item.memberAbility, // 特种作业能力
            checkInDate: item.entryTime // 入岗时间
          };
        });
        this.WeatherForecasts1.paginationAtrrs.total = res.total;
      });
      // this.pageNum = val["current-page"];
      // this.pageSize = val["page-size"];
      // this.list();
    },
    // 待命队伍
    handleSizeChange1(val) {
      this.getduiwuranksDataList(val["current-page"], val["page-size"]);
    },
    // 待命队员分页
    handleSizeChange2(val) {
      this.getduiyuanData(val["current-page"], val["page-size"]);
    }
  }
};
</script>

<style scoped lang="less">
@import "../../../assets/style/common.less";
@import "../../../assets/style/ComponentStyle.less";
@import "../../../assets/style/pop-upNotification.less";

:deep(.el-breadcrumb__inner.is-link) {
  font-weight: 100;
  color: #fff;
}

.EmergencyList :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
  color: #3270ff;
}

.teamSelectionClass {
  position: absolute;
  left: 1%;
  bottom: 2%;
  transform: translate(-50, -50%);
  font-size: 16px;
  font-family: Microsoft YaHei;
}

.choiceNumClass {
  margin-bottom: 10px;
  font-size: 16px;
  font-family: Microsoft YaHei;
}

.box {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 15px;
  background-color: #fff;
  border-radius: 4px;
  padding: 10px;
  box-sizing: border-box;
}

.EmergencyList /deep/.el-button--text {
  width: 100%;
  margin: 0 6px;
}
</style>
